

public class Offer27 {
    public TreeNode mirrorTree(TreeNode root) {
        dfsChange(root);
        return root;
    }

    public void dfsChange(TreeNode root){
        if (root==null) return;
        if (root.left==null&&root.right==null) return;
        TreeNode temp=root.left;
        root.left = root.right;
        root.right = temp;
        dfsChange(root.left);
        dfsChange(root.right);
    }
}
